import { request } from '@/util/request'

// 上传文件
export function uploadFile(data: FormData) {
  return request({
    url: '/virtual/upload/file',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })
}

// 批量上传文件
export function uploadMultipleFiles(files: FormData[]) {
  return Promise.all(files.map((file) => uploadFile(file)))
}

// 删除已上传文件
export function deleteUploadedFile(url: string) {
  return request({
    url: '/api/upload/delete',
    method: 'post',
    data: { url },
  })
}
